PUT Reencode Audio
Overview
The following table contains information about the PUT method in regards for managing the process of reeoncoding a specific audio.
| PUT Reencode Audio | |
|---|---|
| Method | PUT |
| URL or Endpoint | /api/v1/projectId/audios/audioId |
| Headers | Authorization |
| Parameters | audioId, projectId |
| Body | Check the request body below. |
The description of the URL parameters is as follows:
| URL Parameter Name | Mandatory | Type | Description |
|---|---|---|---|
projectId | Yes | string | Unique ID of the project. |
audioId | Yes | string | Unique ID of the audio. |
Request Body
{
"downloadUrl": "https://example.com/{audioFile}",
"callBackUrl": "https://example.com/{callbackEndpoint}",
"hasDrm": true,
"folderId": 0,
"title": "{title}",
"author": "{author}",
"enableDuplicateCheck": true,
"uploadFileDetailsId": 0
}
Information about the fields that appear when you type in the request body are displayed in the table below.
| Parameter Name | Mandatory | Type | Description |
|---|---|---|---|
| downloadUrl | Yes | string | The source of the audio. For a file uploaded through the Upload API send the upload's requestKey (recommended) or the upload URL returned by the Upload API. Any other public URL is accepted unless the project setting encodeUploadedFilesOnly is on, in which case only a request key or a VP upload URL is accepted, see Uploaded files only. |
| callBackUrl | No | string | URL for callback after processing |
| hasDrm | No | boolean | Indicates if DRM is enabled |
| folderId | No | integer | Identifier of the folder |
| title | No | string | Title of the audio. |
| author | No | string | Author on whose behalf the re-encode is requested. When the request references an upload and the project setting enforceUploadOwnership is on, it must match the author stored on that upload, see Upload ownership. It does not change the author of the audio. |
| enableDuplicateCheck | No | boolean | Determines whether duplicate audios should be disallowed. |
| uploadFileDetailsId | No | integer | The ID of upload file details, as returned by the Upload API. Still accepted; sending the upload's requestKey in downloadUrl is recommended instead. When both are sent they must point at the same upload. |
The same rules as for POST Audio apply to a re-encode: with enforceUploadOwnership on, the author must match the referenced upload (403 UPLOAD_AUTHOR_MISMATCH otherwise, identical for unknown references); with encodeUploadedFilesOnly on, the new source must be a request key or a VP upload URL (400 UPLOAD_REFERENCE_REQUIRED otherwise), and one that resolves to one of this project's uploads (rejected as an unknown reference otherwise). The audio is left unchanged when the request is rejected.
Response
{
"success": true,
"errors": [],
"messages": [],
"result": {
"name": "{audioId}",
"originalFile": "https://cdn.vpplayer.tech/{projectId}/audio-encode/{audioId}/mp3/128kbps.mp3"
},
"resultInfo": null,
"statusCode": 200
}
Information about the fields that appear when you receive the response are displayed in the table below.
Top-Level Properties
| Field Name | Type | Description |
|---|---|---|
| success | boolean | If the response is successful it will return true. Otherwise will return false |
| errors | array[string] | Indicates if there was an error |
| messages | array[string] | Returns the response message from back-end |
| result | object | Returns the response object |
| name | string | Unique identifier of the audio |
| originalFile | string | URL of the original audio file |
| resultInfo | string | Returns extra information about the result |
| statusCode | integer | Returns the HTTP Status Code |
If the action is successful, the service sends back an HTTP 200 or 201 response.
Errors
For information about the errors that are common to all actions, see Common Errors:
HTTP Status Code 400: Bad Request
Includes the fixed code
UPLOAD_REFERENCE_REQUIREDwhen the project only accepts uploaded files, see Uploaded files only.HTTP Status Code 401: Unauthorized
HTTP Status Code 403: Forbidden
Includes the fixed code
UPLOAD_AUTHOR_MISMATCHwhen the project enforces upload ownership, see Upload ownership.HTTP Status Code 404: Result Not Found
HTTP Status Code 500: Internal Server Error
HTTP Status Code 503: Backend Fetch Failed